<div id='sidebar-nav' class='sidebar'>
    <div class='sidebar-scroll'>
        <nav>
            <ul class='nav' id='menuul'>
                <!-- <li><a href='/BackStage/index' class='active'><i class='lnr lnr-home'></i> <span>主页</span></a></li>
                    <li><a href='/BackStage/elements' class=''><i class='lnr lnr-code'></i> <span>元素</span></a></li>
                    <li><a href='/BackStage/charts' class=''><i class='lnr lnr-chart-bars'></i> <span>统计</span></a></li>
                    <li><a href='/BackStage/panels' class=''><i class='lnr lnr-cog'></i> <span>容器</span></a></li>
                    <li><a href='/BackStage/notifications' class=''><i class='lnr lnr-alarm'></i> <span>通知信息</span></a></li>
                    <li>
                        <a href='#subPages' data-toggle='collapse' class='collapsed'><i class='lnr lnr-file-empty'></i> <span>收信箱</span> <i class='icon-submenu lnr lnr-chevron-left'></i></a>
                        <div id='subPages' class='collapse '>
                            <ul class='nav'>
                                <li><a href='/BackStage/inbox?mailState=0' class=''>未读消息</a></li>
                                <li><a href='/BackStage/inbox?mailState=1' class=''>已读消息</a></li>
                                <li><a href='/BackStage/inbox?mailState=2' class=''>回收站</a></li>
                            </ul>
                        </div>
                    </li>
                    <li><a href='/BackStage/tables' class=''><i class='lnr lnr-dice'></i> <span>表格</span></a></li>
                    <li><a href='/BackStage/typography' class=''><i class='lnr lnr-text-format'></i> <span>排版</span></a></li>
                    <li><a href='javascript:supperMenu();' class=''><i class='lnr lnr-linearicons'></i> <span>图标</span></a></li> -->
            </ul>
        </nav>
    </div>
</div>


<script>
    var menustr = "";
    $().ready(function () {
        supperMenu();
    });





    function supperMenu() {
        // 使用ajax从后台数据库中取出角色所具有的权限，也就是根菜单
        $.ajax({
            url: '/menu/supperMenu',
            method: 'get',
            data: { roleNo: '2' },
            success: function (data) {
                // alert(123);
                $.each(data,function(i,items){
                    if(items.parentFunctionNo == -1){
                        if (items.childMenu == 0) {
                            menustr += "<li><a href='" + items.functionLoc + "' class=''><i class='" + items.functionIcon + "'></i> <span>" + items.functionName + "</span></a></li>";
                        } else {
                            menustr += "<li>" +
                                "<a href='#"+items.functionName+"' data-toggle='collapse' class='collapsed'><i class='" + items.functionIcon + "'></i> <span>" + items.functionName + "</span> <i class='icon-submenu lnr lnr-chevron-left'></i></a>" +
                                "<div id='"+items.functionName+"' class='collapse '>" +
                                "<ul class='nav'>";
                            $.each(data,function(j,child){
                                if(child.parentFunctionNo == items.functionNo){
                                    menustr += "<li><a href='" + child.functionLoc + "' class='" + child.functionIcon + "'>&nbsp;&nbsp;" + child.functionName + "</a></li>";
                                }
                            })
                            menustr += "</ul>" +
                                        "</div>" +
                                        "</li>";
                           
                        }
                    }
                })
                // alert(menustr);
                $('ul[id="menuul"]').html(menustr);
            }
        });
    }
</script>



